home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Snippets / Networking / Transition Queue Watcher / ATQCGlue.c next >
Encoding:
C/C++ Source or Header  |  1993-01-08  |  2.2 KB  |  59 lines  |  [TEXT/MPS ]

  1. /********************************************************************************
  2.   file: ATQCGlue.c
  3. ********************************************************************************/
  4. #include <Types.h>
  5. #include <AppleTalk.h>
  6.  
  7. /*----------------------------------------------------------------------
  8.         Network Transition Info Record
  9. ----------------------------------------------------------------------*/
  10.  
  11. typedef struct TNetworkTransition {
  12.     Ptr        private;            /* pointer to private structure */
  13.     ProcPtr    netValidProc;        /* pointer to network validation procedure */
  14.     Boolean newConnectivity;    /* true = new connection, */
  15.                                  /* false = loss of connection */
  16.  
  17. }
  18.     TNetworkTransition , *TNetworkTransitionPtr, **TNetworkTransitionHdl;
  19.  
  20. typedef    pascal long    (*NetworkTransitionProcPtr)(TNetworkTransitionPtr netTrans, \
  21.                       unsigned long theNet);
  22.  
  23. /*----------------------------------------------------------------------
  24.         AppleTalk Transition Queue Element
  25. ----------------------------------------------------------------------*/
  26. typedef struct    myATQEntry {
  27.     Ptr        qLink;        /* -> next queue element */
  28.     short        qType;        /* unused */
  29.     ProcPtr    CallAddr;    /* -> transition procedure */
  30.     Ptr        globs;        /* -> to user defined globals */
  31. }
  32.     myATQEntry, *myATQEntryPtr, **myATQEntryHdl;
  33.  
  34. /*----------------------------------------------------------------------
  35.         Prototypes
  36. ----------------------------------------------------------------------*/
  37. pascal long  ATQueueProc (long selector, myATQEntry *q, void *p);
  38. long CALLTRANSQUEUE(long selector, myATQEntry *q, void *p);
  39. /* Capitalize CALLTRANSQUEUE so that linker can match this entry with */
  40. /* the pascal call */
  41. pascal long CallNetValidProc(ProcPtr p, TNetworkTransitionPtr netTrans, long theNet);
  42.  
  43.  
  44. long CALLTRANSQUEUE(long selector, myATQEntry *q, void *p)
  45. /* CallTransQueue sets up the pascal stack for the SampleTransQueue handler */
  46. /* then puts the result into D0 */
  47. {
  48.     return(ATQueueProc(selector, q, p));
  49. }
  50.  
  51. pascal long CallNetValidProc(ProcPtr p, TNetworkTransitionPtr netTrans, long theNet)
  52. /* CallNetValidProc is used to call the netValidProc pointed to by ProcPtr p. */
  53. {
  54.     NetworkTransitionProcPtr    myNTProcPtr;
  55.  
  56.     myNTProcPtr = (NetworkTransitionProcPtr)p;
  57.     return ((*myNTProcPtr)(netTrans, theNet));
  58. }
  59.